﻿#ifndef MYTHREAD_H
#define MYTHREAD_H


#include <QThread>
#include "card/libcard.h"
#include <QDebug>
#include <stdio.h>
#include <QTimer>
#include "signal/libtcu1.06.h"


class MyThread : public QThread //绑卡
{
    Q_OBJECT
protected:
    void run();
signals:
    void sendData(QString data, int value, unsigned int availabelMoney);
private:
    QTimer Count;
    unsigned char count;
private slots:
    void QTimer_Count();
public:
    explicit MyThread(QObject *parent = 0);
    short* getCardNum(void);
    QString getCardType(void);
    rf_card* getCard();
    ~MyThread();
};



class RefreshGun : public QThread//刷新枪结构体信息
{
    Q_OBJECT
protected:
    QTimer updateQrCode;
    void run();

signals:
    void Device_is_Error(int GUN_NO);
    void Device_is_NotConnect(int GUN_NO);
    void StopingCharging(int GUN_NO);
    void onStartingDeviceFail(int GUN_NO);
    void onStartingDevice(int GUN_NO);
    void onCharging(int GUN_NO);
    void ChargeOver_YCT(int GUN_NO);
    void putInCharger(int GUN_NO);

private slots:
    void update_ErrorInfomation();
    void UpdateQRCode();

public slots:
    void ReceiveSwipsignal(QString cardnum, int _focus_gun_);
    void ChargingInfomation_Monitoring(int _focus_gun_);
    void Moitoring_feedback();//监控反馈

private:

public:
//    rf_card* card;
    int GUN_NO;
    int charge_status;
    QTimer Charging_Monitoring;//充电监控定时器
    QTimer* ErrorTimer;//故障刷新定时器,定时刷新故障信息
    int swipCardflag;//刷卡的标志,当刷卡时需要进入选择充电模式,为了不让界面一直调回25Page.1表示刷了卡,0表示还没刷卡
    int swipcard_YCT;//羊城通充电标志位
    int VINcharge;//vin充电标志位
    int appcharge;//app充电标志位
    int putInChargerFlag[8];
    QString ThisGun_SwipCard_Num;//保存在刷卡的卡号,考虑是否将之设置为全局变量?
    explicit RefreshGun(QObject *parent = 0);
    ~RefreshGun();
private:
};

class Debug:public QThread
{
    Q_OBJECT
protected:
    void run();
};
#endif // MYTHREAD_H
